part of 'demos.dart';

class VanDocDemoBlockTitle extends StatelessWidget {
  final String title;
  final double paddingTop;
  final double? paddingLeft;
  final DemoBlockTitleStyle? style;

  const VanDocDemoBlockTitle({super.key, required this.title, this.paddingTop = 32, this.paddingLeft, this.style});

  DemoBlockTitleStyle getComputedStyle() {
    EdgeInsets? padding = style?.padding;

    padding ??= const EdgeInsets.all(16);

    padding = padding.copyWith(top: paddingTop, left: paddingLeft ?? padding.left);
    return DemoBlockTitleStyle(padding: padding);
  }

  @override
  Widget build(BuildContext context) {
    final style = getComputedStyle();
    return SizedBox(
      width: double.infinity,
      child: Padding(
        padding: style.padding!,
        child: Text(title, style: TextStyle(color: kVanDocTextColor4.get(context), fontSize: 14, height: 16 / 14)),
      ),
    );
  }
}

@immutable
class DemoBlockTitleStyle with VanProvide {
  final EdgeInsets? padding;

  const DemoBlockTitleStyle({this.padding});
}
